import { config } from '../../config'

Page({
    data: {
        src: ''
    },
    onLoad: function (options) {
        let oSrc = '';

        if (options) {
            switch(options.type) {
                case 'story' :
                    oSrc = `${config.mUrl}/brandstory?bid=${options.bid}`;
                    wx.setNavigationBarTitle({ title: '品牌故事' })
                break;
                case 'service' :
                    oSrc = `${options.url}`;
                    wx.setNavigationBarTitle({ title: '正品保障体系' })
                break;
                case 'flashsale' :
                    oSrc = `${config.mUrl}/flashSale/${options.tid}?${decodeURIComponent(options.urlParams)}`;
                    wx.setNavigationBarTitle({ title: '秒杀专场' })
                break;
                default:
                    oSrc = `${options.url}`;
                    wx.setNavigationBarTitle({ title: '迷橙' })
            }

            this.setData({
                src: oSrc
            })
            console.log(oSrc)
        }
    },
})